package controller;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Map;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.ProcessAction;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.log4j.Logger;

import com.liferay.util.bridges.mvc.MVCPortlet;

public class XController extends MVCPortlet {
	
	private static final Logger logger = Logger.getLogger(XController.class);
	
    @Override  
    public void render(RenderRequest renderRequest,  RenderResponse renderResponse) throws IOException, PortletException {  
     //Render Logic.  
     super.render(renderRequest, renderResponse);  
    } 
    
    @ProcessAction(name="addName")  
    public void addName(ActionRequest actionRequest,  ActionResponse actionResponse){ 
    	Enumeration<String> enAttr = actionRequest.getAttributeNames(); 
    	while(enAttr.hasMoreElements()){
    	 String attributeName = (String)enAttr.nextElement();
    	 System.out.println("Attribute Name - "+attributeName);
    	 System.out.println("\t Value - "+(actionRequest.getAttribute(attributeName)).toString());
    	}
    	logger.info("addName");
    	String userName = actionRequest.getParameter("userName");
    	logger.info("userName " + userName);
    	actionRequest.setAttribute("userName", userName);  
    }   

}
